Feat/next version - #2036
Conversation
🔍 Commitizen bump previewMerging this PR will produce the following bump: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2036 +/- ##
=======================================
Coverage 98.23% 98.24%
=======================================
Files 61 61
Lines 2784 2799 +15
=======================================
+ Hits 2735 2750 +15
Misses 49 49 ☔ View full report in Codecov by Harness. |
f75472f to
21ab7d4
Compare
|
@Lee-W @bearomorphism if you have some time 🙏🏻 |
There was a problem hiding this comment.
Pull request overview
This PR implements cz version --next support for deriving the next version from git commit history (mirroring cz bump’s increment detection), and updates tests/docs to reflect the new CLI behavior.
Changes:
- Implement
--next USE_GIT_COMMITSincz versionby computing the increment from commits since the tag matching the current version. - Add comprehensive test coverage for the new
USE_GIT_COMMITSbehavior (including major-version-zero and error cases). - Update
cz version --helpsnapshots anddocs/commands/version.mdto document the new usage and examples.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
commitizen/commands/version.py |
Implements commit-derived next-version calculation for cz version --next USE_GIT_COMMITS. |
commitizen/cli.py |
Adjusts argument exclusivity so --next can be combined with --major/--minor/--tag etc. |
commitizen/commands/changelog.py |
Adjusts ChangelogArgs typing for file_name to allow None. |
tests/commands/test_version_command.py |
Adds tests validating git-commit-derived next version and associated errors. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_10_version_.txt |
Updates expected cz version --help output formatting. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_11_version_.txt |
Updates expected cz version --help output formatting. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_12_version_.txt |
Updates expected cz version --help output formatting. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_13_version_.txt |
Updates expected cz version --help output formatting. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_14_version_.txt |
Updates expected cz version --help output formatting. |
docs/commands/version.md |
Documents the new USE_GIT_COMMITS behavior and adds examples. |
AGENTS.md |
Updates agent guidance (testing AAA + documentation guidelines). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
efe2851 to
f6a2481
Compare
Description
Just display the next version based on commits:
# before this PR: 4.16.5 $ cz version -p --next 4.17.0 $ cz version -p --next --minor 17 $ cz version -p --next --major 4This is useful, because it improves the scm provider workflow, which is read-only, based on the tag.
With this features users can easily write themselves:
TODO: Add tutorial for this
On top of that, it's useful for github/forgejo actions for example (not controlled by commitizen, so you'd still need to format the tag):
Checklist
Was generative AI tooling used to co-author this PR?
AI only assisted with testing
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsDocumentation Changes
uv run poe doclocally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
# before this PR: 4.16.5 $ cz version -p --next 4.17.0 $ cz version -p --next --minor 17 $ cz version -p --next --major 4Additional Context